import type {checkVersionModel,settingModel, BaseConfigInfo,WxConfigInfo,AliyunConfigInfo,BaiduConfigInfo } from '@/api/model/settingsModel';
import { request,requestOther } from '@/utils/request';

const Api = {
  CheckVersion:'/settings/check/version',
  List:'/settings/list',
  Edit:'/settings/edit',
  Delete:'/settings/delete',

  BaseConfig:'/settings/base',
  BaiduConfig:'/settings/baidu',
  WxConfig:'/settings/wx',
  AliyunConfig:'/settings/aliyun',
};

export function checkVersion(ver:String) {
  return request.get<checkVersionModel>({
    url: Api.CheckVersion+`?version=${ver}`,
  });
}
export function getSettingsList(group:String) {
  return request.get<Array<settingModel>>({
    url: Api.List+`?name=${group}`,
  });
}
export function saveSettings(d:Array<settingModel>)
{
  return request.post({
    url:Api.Edit,
    data:d
  })
}
export function deleteSettings(id:string)
{
  return request.delete({
    url:Api.Delete+`?id=${id}`
  })
}

//获取微信登录二维码
export function getWxLoginQrcode(d:any)
{
   return requestOther.post({
     url:'https://wx.rscode.cn/wechat/pa/login/qrcode',
     data:d
   })
}







export function getBaseConfig() {
  return request.get<BaseConfigInfo>({
    url: Api.BaseConfig,
  });
}
export function saveBaseCofig(d:BaseConfigInfo)
{
  return request.post({
    url:Api.BaseConfig,
    data:d
  })
}

export function getWxConfig() {
  return request.get<WxConfigInfo>({
    url: Api.WxConfig,
  });
}
export function saveWxConfig(d:WxConfigInfo)
{
  return request.post({
    url:Api.WxConfig,
    data:d
  })
}
export function getBaiduConfig() {
  return request.get<BaiduConfigInfo>({
    url: Api.BaiduConfig,
  });
}

export function saveBaiduConfig(d:BaiduConfigInfo)
{
  return request.post({
    url:Api.BaiduConfig,
    data:d
  })
}
export function getAliyunConfig() {
  return request.get<AliyunConfigInfo>({
    url: Api.AliyunConfig,
  });
}

export function saveAliyunConfig(d:AliyunConfigInfo)
{
  return request.post({
    url:Api.AliyunConfig,
    data:d
  })
}
